package user

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method("POST")
        url("/api/users/roles")
        body("""
            {   
               "userId":1,
               "role":2
               }
            """)
        bodyMatchers {
            jsonPath('$.userId', byRegex(number()))
            jsonPath('$.role', byRegex(number()))
        }
        headers {
            header('Content-Type': 'application/json;charset=UTF-8')
        }
    }
    response {
        status(201)
    }
}